<?php $this->_extends(Helper_Store::layout()); ?>
<?php $this->_block('title'); ?> <?=(strlen($order_id)?$order_id:'')?> - you order -  <?=$store['name']?> <?php $this->_endblock(); ?>
<?php $this->_block('contents'); ?>
<div id="MainWrap">

<div id="InnerLeftColumn">
	<?php $this->_element('categories'); ?>
	<?php $this->_element('tags'); ?>
</div>
<div id="InnerRightColumn"><div class="Navigation"></div>
<?php if(isset($error)&&count($error)):?>
	<div class="notice"> 
		<?php foreach($error as $e=>$v):
			switch($e){
				case 'exist': echo 'No Order Found.<br>'; break;
				default: echo 'any Other Error.<br>';break;
			}
		 endforeach;?>
	</div>
	<?php endif;?>
<div class="CartWrap">
<?php if(!empty($order_id)):?>
  <div class="FormWrap " style="background:#F5F4EC; border:1px solid #E5DDC7;">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="liststyle data">
      <colgroup class="span-auto ColColorBlue">
      </colgroup>
      <colgroup class="span-5 ColColorGray">
      </colgroup>
      <colgroup class="span-4 ColColorGray ">
      </colgroup>
      <tr>
        <td><h4><?=_L('order_sn')?> ：<span class="order_id"><?=$order->order_id?></span></h4></td>
        <td><?=_L('created')?>：<br /><?=Date('Y-m-d H:i:s',$order->created)?></td>
        <td><?=_L('payment_status')?>：<?=$order['status_payment']?><br />
		 <?=_L('shipment_status')?>  : <?=$order['status_shiped']?></td>
      </tr>
    </table>
  </div>
  <div class="FormWrap " style="background:#F5F4EC; border:1px solid #E5DDC7;">
    <h4><?=_L('order_goods')?></h4>
    <div class="division">
      <table width="100%" cellpadding="3" cellspacing="0" class="liststyle">
        <colgroup class="span-auto">
        </colgroup>
        <colgroup class="span-2">
        </colgroup>
        <colgroup class="span-2">
        </colgroup>
        <colgroup class="span-3">
        </colgroup>
        <colgroup class="span-2 ColColorOrange">
        </colgroup>
        <thead>
          <tr>
            <th><?=_L('goods_name')?></th>
            <th><?=_L('price')?></th>
            <th><?=_L('quantity')?></th>
            <th><?=_L('subtotal')?></th>
          </tr>
        </thead>
        <tbody>
		<?php $amount=0; $item_name='';
			foreach($transactions as $t):
				$q=$t->quantity;
				$total= $q*$t->price;
				$amount+=$total;
				$item_name.= $q.'X('.$t->goods->sn.')+';
		?>
          <tr>
            <td><a href="<?=_url('product',array('goods_id'=>$t->goods_id))?>" ><?=$t->title.'('.$t->goods->sn.')'?></a></td>
            <td><?=Helper_currency::fetch($t->price,null,$t->currency)?></td>
            <td><?=$t->quantity?></td>
            <td><?=Helper_currency::fetch($total,null,$t->currency)?></td>
          </tr>
		<?php endforeach;?>
        </tbody>
      </table>
    </div>
    <h4><?=_L('order/shipping')?></h4>
    <div class="division">
      <table width="100%" cellspacing="0" cellpadding="0" class="liststyle data">
        <tr>
          <th><?=_L('member/name')?> :</th>
          <td> <?php if($order['ship_gender']=='m'){echo 'Mr.';}else{echo 'MS.';} ?>
		    <?=$order['ship_firstname']?>  <?=$order['ship_lastname']?></td>
          <th ><?=_L('email')?>:</th>
          <td><?=$order['ship_email']?></td>
        </tr>
        <tr>
          <th><?=_L('city')?> :</th>
          <td>﻿<?=$order['ship_cityname']?> </td>
          <th><?=_L('phone')?>:</th>
          <td><?=$order['ship_phone']?></td>
        </tr>
        <tr>
          <th><?=_L('postalcode')?>:</th>
          <td> <?=$order['ship_postalcode']?></td>
          <th><?=_L('order/shipping')?>:</th>
          <td><?=$shipment->title ?></td>
        </tr>
        <tr>
          <th><?=_L('country')?>:</th>
          <td><?=$order['ship_country']?></td>
          <th><?=_L('payment')?>:</th>
          <td><?=$payment->title?> &nbsp;</td>
        </tr>
        <!--<tr><th>物流公司:</th><td></td><th>公司网址:</th><td><a href='' target='_blank'></a></td></tr>  !-->
        <tr>
          <th><?=_L('company')?>:</th>
          <td> <?=$order['ship_company']?></td>
          <th><?=_L('currency')?>:</th>
          <td><?=$order['currency']?></td>
        </tr>
        <tr>
          <th valign="top"><?=_L('street')?>:</th>
          <td colspan="3" valign="top">﻿<?=$order['ship_street1']?>  <?=$order['ship_street2']?></td>
        </tr>
        <tr>
          <th valign="top"><?=_L('memo')?>:</th>
          <td colspan="3" valign="top"><?=$order['memo']?></td>
        </tr>
      </table>
    </div>
  </div>
  <table border="0" cellspacing="0" cellpadding="0" class="liststyle data" width="100%">
    <col class="span-auto ColColorGray">
    </col>
    <col class="span-4 ColColorOrange textright">
    </col>
    <tr>
      <th><?=_L('goods_amount')?>:</th>
      <td><?=Helper_currency::fetch($order['total_amount'],null,$order['currency'])?></td>
    </tr>
    <tr>
      <th><?=_L('shipping_amount')?>:</th>
      <td><?=Helper_currency::fetch($order['shipping_cost'],null,$order['currency'])?></td>
    </tr>
    <tr>
      <th><?=_L('order_amount')?>:</th>
      <td class="price1"><?=Helper_currency::fetch($order['finel_amount'],null,$order['currency'])?></td>
    </tr>
  </table>
</div>
<?php 
$needpay_amount=0;
if($order['status_payment']=='wait'||$order['status_payment']=='progress'){
	$needpay_amount=$order['finel_amount'];
}?>
<form action="<?=_url('topay')?>" method="post" target="_blank_topay">
<input type="hidden" name="order_id" value="<?=$order['order_id']?>" />
<input type="hidden" name="amount" value="<?=$needpay_amount?>" />
<input type="hidden" name="currency" value="<?=$order['currency']?>" />
<!--input type="hidden" name="cur_money" value="236" />
<input type="hidden" name="cur_rate" value="1.0000" />
<input type="hidden" name="cur_def" value="CNY" /-->
<input type="hidden" name="payment" value="<?=$order['payment_id']?>" />
<input type="hidden" name="item_name" value="<?=rtrim($item_name,'+')?>" />
<div class="FormWrap ">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="liststyle data">
  <colgroup class="span-6 ColColorBlue">
  </colgroup>
  <colgroup class="span-5 ColColorGray textcenter">
  </colgroup>
  <colgroup class="span-auto ColColorGray textcenter">
  </colgroup>
  <tr>
    <td style="padding:6px;"><div style="padding:3px 6px ;"> <?=_L('need_pay')?> </div>
      <h1 style="font-size:30px; margin:0 0 15px 0"><span class="hueorange"><?=Helper_currency::fetch($needpay_amount,null,$order['currency'])?></span></h1></td>
    <td></td>
    <td><?php if($needpay_amount>0):?> <input type="submit" style=" width:80%; padding:14px 20px;border-left:2px solid #FFCC00; border-top:2px solid #FFCC00; border-bottom:2px solid #9F4E2B;border-right:2px solid #9F4E2B; background:#FF9900; color:#FFFFFF; font-weight:bold; font-size:16px;" value="  <?=_L('confirm_pay')?> " />
		<?php else:?>
			<?=_L('payed')?>
		<?php endif;?>
      <br />
      <!--a class="lnk" href="">&raquo;</a-->
  </td>
  </tr>
</table>
</form>
<?php else:?>
No order.
<?php endif;?>
</div>


</div>
	<div style="clear:both"></div>
<?php $this->_endblock('contents'); ?>
